package com.ruoyi.web.controller.combat;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.combat.domain.CombatAtlasNewTask;
import com.ruoyi.combat.service.ICombatAtlasNewTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 课题四任务Controller
 * 
 * @author ruoyi
 * @date 2025-07-04
 */
@RestController
@RequestMapping("/combat/atlastask")
@Api(tags = "课题四任务管理")
public class CombatAtlasTaskController extends BaseController
{
    @Autowired
    private ICombatAtlasNewTaskService combatAtlasTaskService;

    /**
     * 查询课题四任务列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "查询课题四任务列表")
    public TableDataInfo list(CombatAtlasNewTask combatAtlasTask)
    {
        startPage();
        List<CombatAtlasNewTask> list = combatAtlasTaskService.selectCombatAtlasTaskList(combatAtlasTask);
        return getDataTable(list);
    }

    /**
     * 导出课题四任务列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, CombatAtlasNewTask combatAtlasTask)
    {
        List<CombatAtlasNewTask> list = combatAtlasTaskService.selectCombatAtlasTaskList(combatAtlasTask);
        ExcelUtil<CombatAtlasNewTask> util = new ExcelUtil<CombatAtlasNewTask>(CombatAtlasNewTask.class);
        util.exportExcel(response, list, "课题四任务数据");
    }

    /**
     * 获取课题四任务详细信息
     */
    @GetMapping(value = "/{id}")
    @ApiOperation("任务详情")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(combatAtlasTaskService.selectCombatAtlasTaskById(id));
    }

    /**
     * 新增课题四任务
     */
    @PreAuthorize("@ss.hasPermi('combat:atlastask:add')")
    @Log(title = "课题四任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CombatAtlasNewTask combatAtlasTask)
    {
        return toAjax(combatAtlasTaskService.insertCombatAtlasTask(combatAtlasTask));
    }

    /**
     * 修改课题四任务
     */
    @PreAuthorize("@ss.hasPermi('combat:atlastask:edit')")
    @Log(title = "课题四任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CombatAtlasNewTask combatAtlasTask)
    {
        return toAjax(combatAtlasTaskService.updateCombatAtlasTask(combatAtlasTask));
    }

    /**
     * 删除课题四任务
     */
    @PreAuthorize("@ss.hasPermi('combat:atlastask:remove')")
    @Log(title = "课题四任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(combatAtlasTaskService.deleteCombatAtlasTaskByIds(ids));
    }
}
